// pages/collect/collect.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    goodsInfo:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getCollectionGoods()
  },

  goDeatilPage(event){
    const {id} = event.currentTarget.dataset
    wx.navigateTo({
      url: '/pages/goods_detail/goods_detail?id=' + id
    });

  },

  //从本地缓存中获取收藏的数据
  getCollectionGoods(){
    const goodsInfo = wx.getStorageSync('collection_goods') || [];
    this.setData({goodsInfo})
  },


})